<?php

/**
 * InquireForm class.
 * InquireForm is the data structure for keeping
 * inquire form data. It is used by the 'inquire' action of 'SiteController'.
 */
class InquireForm extends CFormModel
{
	public $name;
	public $phone;
	public $email;
	public $body;
	public $verifyCode;

	/**
	 * Declares the validation rules.
	 */
	public function rules()
	{
		return array(
			// name, email, subject and body are required
			array('name, email, body, phone', 'required'),
			array('phone', 'numerical', 'integerOnly'=>true),
			// email has to be a valid email address
			array('email', 'email'),
			// verifyCode needs to be entered correctly
			array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
		);
	}

	/**
	 * Declares customized attribute labels.
	 * If not declared here, an attribute would have a label that is
	 * the same as its name with the first letter in upper case.
	 */
	public function attributeLabels()
	{
		return array(
			'name'=>Yii::t('label','Name'),
			'phone'=>Yii::t('label','Phone'),
			'email'=>Yii::t('label','Email'),
			'body'=>Yii::t('label','Body'),
			'verifyCode'=>Yii::t('label','Verify Code'),
		);
	}
}
